print("vvedi posledovatelnost skobok: ")
a=input()
b=""
c=True
skobki=['(',')','[',']', '{','}','<','>']
for x in a :
    if x in "([{<":
        b += x
    if x in ")]}>":
        if len(b) == 0:
            c = False
            break
        if b[-1] == "(" and x == ")" or b[-1]=="{" and x == "}" or b[-1]=="[" and x == "]" or b[-1]=="<" and x == ">":
            b = b[0:-1]
        else:
            c = False
            break
print(c)
